@include('blog.layouts.header')
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <!--<h1 class="page-header">Dashboard</h1>-->

          <h2 class="sub-header">文章列表</h2>
          <button type="button" class="btn btn-primary" onclick="location.href='{{url('blog/add')}}'">添加文章</button>
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>编号</th>
                  <th>标题</th>
                  <th>作者</th>
                  <th>添加时间</th>
                  <th>状态</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                @foreach ($article_list as $article)
                <tr>
                  <td>{{ $article->article_id }}</td>
                  <td><a href="{{url('blog/detail', $article->article_id)}}" target="_blank">{{ $article->title }}</a></td>
                  <td>{{ $article->author }}</td>
                  <td>{{ $article->add_time }}</td>
                  <td>
                    @if ($article->is_open == 1)
                      开始
                    @else
                      关闭
                    @endif
                  </td>
                  <td>
                    <a href="{{url('blog/edit', $article->article_id)}}">编辑</a>
                    <a href="javascript:;" data-url="{{url('blog/delete', $article->article_id)}}" data-opt="delete">删除</a>
                  </td>
                </tr>
                @endforeach
              </tbody>
            </table>
          </div>
        </div>

<script>
$(document).on('click', "[data-opt='delete']", function(){
  if(window.confirm("是否确定删除该文章") == true){
    location.href = $(this).data('url');
  }
})
</script>
@include('blog.layouts.footer')